package com.sihai.core.utils;

import org.apache.commons.lang.math.Range;

/**
 * utility class for jakarta commons range
 */
public class RangeUtils {

    private RangeUtils() {
    }


    /**
     * get random number in range
     *
     * @param range jakarta commons lang math Range
     * @return random number in range
     */
    public static long random(Range range) {    
        long min = range.getMinimumLong();
        long max = range.getMaximumLong();
        return (long) (Math.random() * (max - min + 1)) + min;
    }
}
